Building Optimal Binary Search Trees from Sorted Values in O(N) Time

نویسنده

  • Jean G. Vaucher
چکیده

First, we present a simple algorithm which, given a sorted sequence of node values, can build a binary search tree of minimum height in O(N) time. The algorithm works with sequences whose length is, a priori, unknown. Previous algorithms [1-3] required the number of elements to be known in advance. Although the produced trees are of minimum height, they are generally unbalanced. We then show how to convert them into optimal trees with a minimum internal path length in O(log N) time. The trees produced, both minimum height and optimal, have characteristic shapes which can easily be predicted from the binary representation of tree size.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Optimal Binary Search Trees

An optimal binary search tree is a binary search tree for which the nodes are arranged on levels such that the tree cost is minimum. For the purpose of a better presentation of optimal binary search trees, we will consider “extended binary search trees”, which have the keys stored at their internal nodes. Suppose “n” keys k1, k2, ... , k n are stored at the internal nodes of a binary search tre...

متن کامل

On a Sublinear Time Parallel Construction of Optimal Binary Search Trees

We design an eecient sublinear time parallel construction of optimal binary search trees. The eeciency of the parallel algorithm corresponds to its total work (the product time processors). Our algorithm works in O(n 1? log n) time with the total work O(n 2+2), for an arbitrarily small constant 0 < 1 2. This is optimal within a factor n 2 with respect to the best known sequential algorithm give...

متن کامل

Construction of Optimal Binary Split Trees in the Presence of Bounded Access Probabilities

A binary split tree is a search structure combining features of heaps and binary search trees. The fastest known algorithm for building an optimal binary split tree requires (n 4) time if the keys are distinct and O(n 5) time if the keys are non-distinct. (n 3) space is required in both cases. A modiication is introduced which reduces a factor of n 2 in the asymptotic time to a factor of n lg(n...

متن کامل

Optimal Binary Search Trees with Near Minimal Height

Suppose we have n keys, n access probabilities for the keys, and n+1 access probabilities for the gaps between the keys. Let hmin(n) be the minimal height of a binary search tree for n keys. We consider the problem to construct an optimal binary search tree with near minimal height, i.e. with height h ≤ hmin(n) +∆ for some fixed ∆. It is shown, that for any fixed∆ optimal binary search trees wi...

متن کامل

An O(log log n)-Competitive Binary Search Tree with Optimal Worst-Case Access Times

We present the zipper tree, the first O(log logn)-competitive online binary search tree that performs each access in O(log n) worst-case time. This shows that for binary search trees, optimal worst-case access time and near-optimal amortized access time can be guaranteed simultaneously.

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2004